import request from '@/utils/request_app'

//单个商品预下单
export const goodsPreOrder = data => {
  return request({
    url: 'app/mall/order/goodsPreOrder',
    method: 'post',
    data: data,
  })
}

//购物车商品预下单
export const cartPreOrder = data => {
  return request({
    url: 'app/mall/order/cartPreOrder',
    method: 'post',
    data: data,
  })
}

//单个商品下单
export const takeOrder = data => {
  return request({
    url: 'app/mall/order/takeOrder',
    method: 'post',
    data: data,
  })
}

//根据条件获取用户订单列表
export const getOrderList = data => {
  return request({
    url: 'app/mall/order/list',
    method: 'post',
    data: data,
  })
}

//获取订单详情
export const getOrderDetail = data => {
  return request({
    url: 'app/mall/order/info',
    method: 'get',
    params: data,
  })
}

//取消订单
export const cancelOrder = data => {
  return request({
    url: 'app/mall/order/cancel',
    method: 'get',
    params: data,
  })
}

//提醒发货
export const remindSend = data => {
  return request({
    url: 'app/mall/order/remind',
    method: 'post',
    data: data,
  })
}

//确认收货
export const confirmReceive = data => {
  return request({
    url: 'app/mall/order/sign',
    method: 'get',
    params: data,
  })
}

//提醒发货
export const applyRefund = data => {
  return request({
    url: 'app/mall/refundOrder/add',
    method: 'post',
    data: data,
  })
}

//根据条件获取订单明细列表
export const getOrderGoodsList = data => {
  return request({
    url: 'app/mall/orderDetail/list',
    method: 'post',
    data: data,
  })
}

//添加退货信息
export const inputRefundInfo = data => {
  return request({
    url: 'app/mall/refundOrder/express',
    method: 'post',
    data: data,
  })
}

//获取退款单详情
export const getRefundDetail = data => {
  return request({
    url: 'app/mall/refundOrder/info',
    method: 'get',
    params: data,
  })
}

//获取退款单列表
export const getRefundList = data => {
  return request({
    url: 'app/mall/refundOrder/list',
    method: 'post',
    data: data,
  })
}

//退款选择商品后重新计算金额
export const coutRefundAmount = data => {
  return request({
    url: 'app/mall/refundOrder/refundAmount',
    method: 'post',
    data: data,
  })
}

//取消退款申请
export const cancelApply = data => {
  return request({
    url: 'app/mall/refundOrder/cancel',
    method: 'get',
    params: data,
  })
}

//退款申请平台介入
export const appealApply = data => {
  return request({
    url: 'app/mall/refundOrder/appeal',
    method: 'get',
    params: data,
  })
}

//获取协商历史
export const getRefundLog = data => {
  return request({
    url: 'app/mall/refundOperLog/list',
    method: 'post',
    data: data,
  })
}

//获取用户待评价订单列表
export const getNotCommentList = data => {
  return request({
    url: 'app/mall/orderDetail/notCommentList',
    method: 'post',
    data: data,
  })
}

//获取用户已评价列表
export const getCommented = data => {
  return request({
    url: 'app/mall/goodsComment/userCommented',
    method: 'post',
    data: data,
  })
}

//物流列表
export const getOrderExpressList = data => {
  return request({
    url: 'app/mall/orderExpress/list',
    method: 'post',
    data: data,
  })
}

//物流详情
export const getOrderExpressDetail = data => {
  return request({
    url: 'app/mall/orderExpress/info',
    method: 'get',
    params: data,
  })
}

//物流详情
export const getOrderExpressDetailNew = data => {
  return request({
    url: 'app/user/promotionPetFood/orderExpress',
    method: 'get',
    params: data,
  })
}
